<?php
include('../../inc/global.inc');
include("../islogin.php");
$url="phone.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=20;

if($_POST[phone]){
$texts=$_POST[phone];
$num=count($_POST[phone]); 
for($i=0;$i<$num;$i++){
$phone=$phone.$texts[$i].",";

}
echo "<script>javascript:opener.document.form1.m_phone.value='$phone';window.close();</script>";
}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="../css/css.css" />
</head>
<body>
<TABLE width="90%" border="0" align="center" cellPadding="0" cellSpacing="1" bgcolor="#000000">
   <TR>
     <TD height="40" bgcolor="#EEEEF9" style="font-size:18px;font-weight:bold;padding-left:8px;">筛选手机号码</TD>
   </TR>
</TABLE>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
  <form method="get" action="" name="form1">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding:5px;line-height:25px;">
	  开始编号<input name="f_id" type="text" size="15">&nbsp;- 结束编号&nbsp;<input name="t_id" type="text" size="15"><input name="submit" type="submit" value="搜索">
      </td>
    </tr>
  </form>
</table>
<table width="90%" align="center" cellspacing="1" bgcolor="#000000">
<form method="post" name="form1" action="">
       <tr>
          <td width="5%" height="30" align="center" bgcolor="#8DA8CF">编号</td>
          <td width="8%" align="center" bgcolor="#8DA8CF">ID</td>
          <td width="15%" align="center" bgcolor="#8DA8CF">账号</td>
          <td width="37%" align="center" bgcolor="#8DA8CF">公司名称</td>
          <td width="23%" align="center" bgcolor="#8DA8CF">手机号码</td>
          <td width="12%" align="center" bgcolor="#8DA8CF">全选<input type="checkbox" name="checkbox" value="check all" onClick="checkall();"/>&nbsp;&nbsp;<input type="submit" name="Submit" value="提交" class="submit" /></td>
      </tr>
<?php
if($_GET[f_id]&&$_GET[t_id]){
$sqls=" and id<=$_GET[t_id] and id>=$_GET[f_id]";

}
$sql="select id,m_cname,m_phone,m_user from member where m_type=3 and m_mode=1 ".$sqls." order by id desc limit ".($thepage-1)*$maxpage.",$maxpage";
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
		?>
        <tr>
          <td height="22" align="center" bgcolor="#FFFFFF"><?=$i?></td>
          <td align="center" bgcolor="#FFFFFF"><?=$row['id']?></td>
          <td align="center" bgcolor="#FFFFFF"><?=$row['m_user']?></td>
          <td align="center" bgcolor="#FFFFFF"><?=$row['m_cname']?></td>
          <td align="center" bgcolor="#FFFFFF"><?=$row['m_phone']?></td>
          <td align="center" bgcolor="#FFFFFF"><input type="checkbox" name="phone[]" id="phone[]" value="<?=$row['m_phone']?>"></td>
        </tr>
<?php
$i++;
}?></form>
<?php
$rs2=@mysql_query("select count(id) from member where m_type=3 and m_mode=1 ".$sqls);
$totalrecord=@mysql_result($rs2,0);
$totalpage=ceil($totalrecord/$maxpage);
@mysql_free_result($rs2);
if($totalpage>0){
?>
        <tr>
          <td colspan="6" align="center" bgcolor="#FFFFFF" height="18"><form method="get" action="<?=$url?>">
<?php if($thepage>1){?>
   <a href="<?=$url?>">第一页</a>&nbsp;<a href="<?=$url?>?page=<?=$thepage-1?>">上一页</a>&nbsp;
<?php }?>  
<?php if($thepage!=$totalpage&&$totalpage>1){?>
   <a href="<?=$url?>?page=<?=$thepage+1?>">下一页</a>&nbsp;<a href="<?=$url?>?page=<?=$totalpage?>">最后一页</a>&nbsp;
<?php }?>   
   【共<font color="red"><?=$totalrecord?></font>条记录】【每页<font color="red"><?=$maxpage?></font>条记录】【共<font color="red"><?=$totalpage?></font>页】<input type="text" name="page" size="3" onKeyUp="IsDigit(this);">&nbsp;<input type="submit" value="GO"></form></td>
        </tr><?php }?>
</table>
</body>
</html>

<SCRIPT language=javascript>
function checkall()
{
   var a = document.getElementsByTagName("input");
   if(a[1].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</SCRIPT>
<script language="javascript">
function IsDigit(obj) 
{ 
if(obj.value.replace(/[\d+]/ig,"").length>0) { 
  alert('请输入数字'); 
  document.getElementById(obj).value =""; 
} 
} 
</script>